package models;

import play.data.validation.Required;
import play.db.jpa.Model;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import java.util.Date;

@Entity
public class Absence extends Model {
    @Required       
    public boolean justifie;
    @Required
    @ManyToOne
    public Utilisateur eleve;
    @Required
    @ManyToOne
    public Sceance sceance;
    @Required
    public long dateAbsence;

    public Absence(Utilisateur eleve, Sceance sceance) {
        this.justifie = false;
        this.eleve = eleve;
        this.sceance = sceance;
        this.dateAbsence = System.currentTimeMillis()/1000;
    }

    public boolean isJustifie() {
        return justifie;
    }

    public void setJustifie(boolean justifie) {
        this.justifie = justifie;
    }

    public Utilisateur getEleve() {
        return eleve;
    }

    public void setEleve(Utilisateur eleve) {
        this.eleve = eleve;
    }

    public Sceance getSceance() {
        return sceance;
    }

    public void setSceance(Sceance sceance) {
        this.sceance = sceance;
    }
}
